Skip to main content

All Questions

Tagged with
2votes
1answer
145views

Count how many numbers in a range have exactly three divisors

The challenge Given array a of n numbers, I need to count how many positive numbers less than each aᵢ have exactly 3 divisors. Constraints 1 <= aᵢ <= 2.5 * 10¹³ In other words, the minimum ...
Muhammad Usman's user avatar
0votes
2answers
596views

Configuring SQLite3 for best efficiency as a persistent cache

I'm using SQLite3, via php's extension module, to create a persistent object cache for WordPress. It's intended for use on modestly sized sites that don't have access to redis or memcached. Why use ...
O. Jones's user avatar
2votes
1answer
168views

C/C++ hash looking in flat database compared to PHP

I have a hash table which I would like to query as fast as possible. The hash table is stored this way : When I query a hash, I extract first 4 characters then use it to find the file. For instance a ...
James's user avatar
2votes
1answer
127views

function to group data by parent branches

I wrote this function to take database output like from PDO's fetchAll(PDO::FETCH_ASSOC) and turn it into a tree. For small datasets it works well. However, when ...
aswine's user avatar
4votes
3answers
1kviews

Filter an array, but remove the filtered elements

I needed a PHP function that would filter values from one array into a new one, while also removing those values from the original array. After looking through the docs, I didn't see any such function,...
Bee H.'s user avatar
2votes
1answer
418views

Laravel 9 - Metadata creation using middleware?

I wrote a middleware for laravel that grabs the current metadata for the specific URL you visit. How it works: we use the $request and compare the current URL: <...
user avatar
0votes
1answer
83views

PHP game - changing color of cells in a blue and white grid => updating groups of white cells that touch each other

My game is a grid in which you have to change cells color by clicking on them. When I generate a grid I have to know all the possible combinations of blue and white cells my game allows, to know the ...
Romain Charles's user avatar
2votes
1answer
178views

Prevent Column Name Collision

I have been working on a series of posts about a library to connect to databases but most of the scenarios I have to resort to some "JOIN" the problem arose when two or more tables had some ...
user avatar
1vote
1answer
2kviews

PHP Group associative Array duplicates and make subarrays of different values

I have this type of table: ...
aurepito's user avatar
-2votes
1answer
48views

Grab user info from database via exec

I'm using the following code to grab user info from my MySQL database via PHP by using exec to invoke a Python script. ...
LimesBytefend's user avatar
-1votes
2answers
88views

Simple Vehicle speed representation [closed]

This code models two vehicle types, with a method to accept a string representing a boost to change speed. How can I optimize performance in inheritance child class? How can I reduce the code inside ...
manas's user avatar
0votes
0answers
75views

PHP SCRIPT OPTIMIZATION OF METHODS

Here is some php code which i think is optimized but still want to optimize it more but not sure how to do it. ...
newtophp's user avatar
2votes
0answers
71views

Copy images using curl to make API calls

I am a junior web developer currently doing my first internship and I had a lot of freedom to solve small problems the way I thought was best. (There aren't really any developers here so I am ...
YFDev's user avatar
1vote
2answers
102views

Check URL for keywords [closed]

I'm looking at improving my PHP knowledge and wondering if anybody has any tips on improving and optimising my function below? ...
stu's user avatar
  • 21
1vote
1answer
63views

Automatic notification system about changes to court cases

I have written an application for lawyers' offices. There is an API to fetch info about court cases. I have implemented API calls for front end when user enters particular case; one tab is filled with ...
ikiK's user avatar
  • 111

153050per page
close